package com.xiaoshou.pojo;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "user", catalog = "market")
public class User implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private String id;
	private String username;
	private String password;
	private String role;
	private String pic;
	private List<Question> questions = new ArrayList<Question>();
	private List<Lectures> lectureses = new ArrayList<Lectures>();
	private List<Comment> comments = new ArrayList<Comment>();
	private List<Answers> answerses = new ArrayList<Answers>();
	private List<Departments> departmentses = new ArrayList<Departments>();
	private List<Reply> replies = new ArrayList<Reply>();
	private List<Files> fileses = new ArrayList<Files>();

	// Constructors

	/** default constructor */
	public User() {
	}

	/** minimal constructor */
	public User(String id) {
		this.id = id;
	}

	/** full constructor */
	public User(String id, String username, String password, String role,
			String pic, List<Question> questions, List<Lectures> lectureses,
			List<Comment> comments, List<Answers> answerses,
			List<Departments> departmentses, List<Reply> replies,
			List<Files> fileses) {
		this.id = id;
		this.username = username;
		this.password = password;
		this.role = role;
		this.pic = pic;
		this.questions = questions;
		this.lectureses = lectureses;
		this.comments = comments;
		this.answerses = answerses;
		this.departmentses = departmentses;
		this.replies = replies;
		this.fileses = fileses;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 40)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "username", length = 45)
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name = "password", length = 45)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "role", length = 45)
	public String getRole() {
		return this.role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	@Column(name = "pic", length = 45)
	public String getPic() {
		return this.pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Question> getQuestions() {
		return this.questions;
	}

	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Lectures> getLectureses() {
		return this.lectureses;
	}

	public void setLectureses(List<Lectures> lectureses) {
		this.lectureses = lectureses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Comment> getComments() {
		return this.comments;
	}

	public void setComments(List<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Answers> getAnswerses() {
		return this.answerses;
	}

	public void setAnswerses(List<Answers> answerses) {
		this.answerses = answerses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Departments> getDepartmentses() {
		return this.departmentses;
	}

	public void setDepartmentses(List<Departments> departmentses) {
		this.departmentses = departmentses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Reply> getReplies() {
		return this.replies;
	}

	public void setReplies(List<Reply> replies) {
		this.replies = replies;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<Files> getFileses() {
		return this.fileses;
	}

	public void setFileses(List<Files> fileses) {
		this.fileses = fileses;
	}

}